<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>
			添加菜单
		</title>
		<script src="{{__PUBLIC__}}/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" href="{{__PUBLIC__}}/hdjs/hdjs.css"/>
		<script type="text/javascript" src="{{__PUBLIC__}}/hdjs/hdjs.min.js"></script>
		{{bootstrap}}
		{{css file="__VIEW__/common.css"}}
	</head>
	<body>
		<form id="form" method="post" onsubmit="return add()">
			<table class="hd-table hd-table-form hd-form">
				<thead>
					<tr>
						<td colspan="3">
							设置菜单
						</td>
					</tr>
				</thead>
				<tbody>
					<tr>
						<th width="100">
							父级
						</th>
						<td colspan="2">
							<select name="pid">
								<option value="顶级栏目" {{$data['top']}}>
									顶级菜单
								</option>
								{{foreach from="$data" key="$k" value="$v"}}
								<option value="{{$v['id']}}" {{$v['num']}}
								{{if value="$pid==$v['id']"}}
								selected=''
								{{endif}}
								>
									{{$v['_name']}}
								</option>
								{{endforeach}}
							</select>
						</td>
						
					</tr>
					<tr>
						<th>
							name
						</th>
						<td>
							<input type="text" name="name" required=""  value="" class="hd-w300">
						</td>
						<td>
							<span class="hd-validate-notice" style="display: inline-block;">
								菜单标题，不超过16个字节，子菜单不超过40个字节
							</span>
						</td>
					</tr>
					
					<tr>
						<th>
							type
						</th>
						<td>
							<input type="radio" name="type" value="click" checked>
							click
							<input type="radio" name="type" value="view">
							view
						</td>
						<td>
							<span class="hd-validate-notice" style="display: inline-block;">
								菜单的响应动作类型
							</span>
						</td>
					</tr>
					<tr>
						<th>
							keyword
						</th>
						<td>
							<input type="text" name="key" class="hd-w300">
						</td>
						<td>
							<span class="hd-validate-notice" style="display: inline-block;">
								菜单KEY值，用于消息接口推送，不超过128字节
							</span>
						</td>
					</tr>
					
					<tr>
						<th>
							URL
						</th>
						<td>
							<input type="text" name="url" value="http://" class="hd-w300">
						</td>
						<td>
							<span class="hd-validate-notice" style="display: inline-block;">
								网页链接，用户点击菜单可打开链接，不超过256字节
							</span>
						</td>
					</tr>
					
					<tr>
						<th>
							描述
						</th>
						<td>
							<textarea name="describe" class="hd-w500 hd-h100"></textarea>																																			

						</td>
						<td>
							<span class="hd-validate-notice" style="display: inline-block;">
								
							</span>
						</td>
					</tr>
					<tr>
						<td colspan="2">
							<input type="submit" class="hd-btn hd-btn-primary">
						</td>
						<td>
							<span class="hd-validate-notice" style="display: inline-block;">
								
							</span>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
		<script type="text/javascript">
			function add()
			{
				$.post("{{U('add')}}",$("#form").serialize(),function(data){

						hd_alert({
							message: data.message,
							timeout: 3,
						});
					location.href="{{U('index')}}";
				},'json');
				return false;
			}
		</script>
	</body>
</html>